package com.dier.webservices.restful.util;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;

import com.dier.webservices.restful.enumerador.CalificacionEnum;
import com.dier.webservices.restful.enumerador.GeneroEnum;
import com.dier.webservices.restful.model.Film;

@Service
public class LoadData {

	private List<Film> listOfFilms;
	
	public LoadData(){
		init();
	}
	
	public Boolean addNewFilm(Film film){
		return listOfFilms.add(film);
	}
	
	public Boolean deleteFilm(Film deleteFilm){
		return listOfFilms.remove(deleteFilm);
	}
	
	
	private void init(){
		listOfFilms = new ArrayList<Film>();
		
		List<GeneroEnum> generoFilm = new ArrayList<GeneroEnum>();
		generoFilm.add(GeneroEnum.ACCION);
		generoFilm.add(GeneroEnum.CIENCIA_FICCION);
		
		listOfFilms.add(new Film(1, "Batman", "215", 
				CalificacionEnum.MAS_18, 
				generoFilm, 
				new Date(), "Nothing"));
		
		
		listOfFilms.add(new Film(2, "Superman", "190", 
				CalificacionEnum.MAS_8, 
				generoFilm, 
				new Date(), "Nothing"));
		
		listOfFilms.add(new Film(3, "Lobezno", "180", 
				CalificacionEnum.MAS_18, 
				generoFilm, 
				new Date(), "Nothing"));
		
		listOfFilms.add(new Film(4, "Iron man 3", "220", 
				CalificacionEnum.MAS_13, 
				generoFilm, 
				new Date(), "Nothing"));
	}

	public List<Film> getListOfFilms() {
		return listOfFilms;
	}

	public void setListOfFilms(List<Film> listOfFilms) {
		this.listOfFilms = listOfFilms;
	}
	
}
